package com.handsome;

import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @author 识时务者
 * @email 1327259918@qq.com
 */
// 允许异步任务功能
// @EnableAsync
// 允许定时任务功能
// @EnableScheduling
@SuppressWarnings({"all"})
@MapperScan("com.handsome.dao")
@SpringBootApplication
@Slf4j
public class HandsomeBlogApplication {
    public static void main(String[] args) throws UnknownHostException {
        // 关闭Warning: Nashorn engine is planned to be removed from a future JDK release的提示
        // System.setProperty("nashorn.args", "--no-deprecation-warning");
        ConfigurableApplicationContext context = SpringApplication.run(HandsomeBlogApplication.class, args);
        // 获取端口号
        String serverPort = context.getEnvironment().getProperty("server.port");
        // 获取本机对象
        InetAddress localHost = InetAddress.getLocalHost();
        // 输出本机名称
        // System.out.println(localHost.getHostName());
        // 获取本地IP地址
        String IP = localHost.getHostAddress();
        log.info("项目地址：http://" + IP + ":" + serverPort);
    }
}
